import 'package:permission_handler/permission_handler.dart';

class PermissionService {
  // 检查是否已经授权
  static Future<bool> checkPermission(Permission permission) async {
    PermissionStatus status = await permission.status;
    return status.isGranted;
  }

  // 请求权限
  static Future<bool> requestPermission(Permission permission) async {
    PermissionStatus status = await permission.request();
    return status.isGranted;
  }

  // 请求存储权限
  static Future<bool> requestStoragePermission() async {
    return await requestPermission(Permission.storage);
  }

  // 检查存储权限
  static Future<bool> checkStoragePermission() async {
    return await checkPermission(Permission.storage);
  }
}
